package com.iplant.mes.service.po.sfc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.mes.service.mesenum.sfc.SFCLoginType;

import java.util.Calendar;

/**
 * 打卡记录
 *
 * @author YouWang·Peng
 * 2023-8-25 14:28:24
 */
@DBBasePO(TableName = "sfc_login_event", Name = false, Active = false, Schemas = DBSchemas.MES,
        CheckName = {"Code", "TaskSelfID,RecordType"}, CodeAuto = true, CodePrefix = "CKR-{yyMMdd}-",
        CodeNum = 4)
public class SFCLoginEvent extends BasePO {

    @DBField
    public int OrderID = 0;

    @DBField
    public String OrderNo = "";
    @DBField
    public int RoutePartID = 0;

    @DBJoin(name = "Name", tableName = "fpc_routepart", tableAsName = "fpc_routepart1", Schemas = DBSchemas.PDM,
            MainTableField = "RoutePartID")
    public String RoutePartName = "";
    @DBField
    public int RoutePartPointID = 0;

    @DBJoin(name = "Name", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public String RoutePartPointName = "";

    @DBJoin(name = "ComponentType", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public int ComponentType = 0;

    @DBCondition
    @DBField
    public int ProductID = 0;

    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductCode = "";

    @DBJoin(name = "ComponentNumber", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public int ComponentNumber = 1;

    @DBField
    public int TaskPartID;
    @DBField
    public int TaskPartPointID;

    @DBCondition
    @DBField
    public int TaskPartPointDayID;
    /**
     * 车间ID
     */
    @DBCondition
    @DBField
    public int WorkShopID = 0;
    @DBJoin(name = "Name", tableName = "fmc_workshop", tableAsName = "workshop1", Schemas = DBSchemas.Basic,
            JoinIndex = 2,
            MainTableField = "WorkShopID")
    public String WorkShopName = "";
    /**
     * 车间编码
     */
    @DBJoin(name = "Code", tableName = "fmc_workshop", tableAsName = "workshop1", Schemas = DBSchemas.Basic,
            JoinIndex = 2,
            MainTableField = "WorkShopID")
    public String WorkShopCode = "";

    /**
     * 工区ID
     */
    @DBCondition
    @DBField
    public int WorkAreaID = 0;
    /**
     * 工区名称
     */
    @DBJoin(name = "Name", tableName = "fmc_workarea", tableAsName = "workarea1", Schemas = DBSchemas.Basic,
            JoinIndex = 3,
            MainTableField = "WorkAreaID")
    public String WorkAreaName = "";
    /**
     * 工区编码
     */
    @DBJoin(name = "Code", tableName = "fmc_workarea", tableAsName = "workarea1", Schemas = DBSchemas.Basic,
            JoinIndex = 3,
            MainTableField = "WorkAreaID")
    public String WorkAreaCode = "";

    /**
     * 工位ID
     */
    @DBCondition
    @DBField
    public int StationID = 0;
    /**
     * 工位名称
     */
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "station1", Schemas = DBSchemas.Basic,
            JoinIndex = 4,
            MainTableField = "StationID")
    public String StationName = "";
    /**
     * 工位编码
     */
    @DBJoin(name = "Code", tableName = "fmc_station", tableAsName = "station1", Schemas = DBSchemas.Basic,
            JoinIndex = 4,
            MainTableField = "StationID")
    public String StationCode = "";

    @DBField
    public Calendar StationDate = Calendar.getInstance();
    @DBField
    public int ShiftType = 0;
    /**
     * 原计划数量
     */
    @DBJoin(name = "PlantNum", tableName = "aps_task_partpoint_day", tableAsName = "aps_task_partpoint_day1", Schemas =
            DBSchemas.APS,
            JoinIndex = 4,
            MainTableField = "TaskPartPointDayID")
    public float SPlantNum = 0.0f;

    /**
     * 当班次班组长确定计划数
     */
    @DBJoin(name = "DPlantNum", tableName = "aps_task_partpoint_day", tableAsName = "aps_task_partpoint_day1", Schemas =
            DBSchemas.APS,
            JoinIndex = 4,
            MainTableField = "TaskPartPointDayID")
    public float DPlantNum = 0.0f;

    /**
     * 派工任务ID
     */
    @DBField
    public int TaskSelfID = 0;

    /**
     * 个人计划数
     * 给每个人的计划数量  几个人的加起来要默认等于PlantNum
     */
    @DBJoin(name = "PlantNum", tableName = "sfc_task_self", tableAsName = "sfc_task_self1", Schemas = DBSchemas.MES,
            MainTableField = "TaskSelfID")
    public float PlantNum = 0.0f;


    /**
     * 实际执行数量
     */
    @DBJoin(name = "ActNum", tableName = "sfc_task_self", tableAsName = "sfc_task_self1", Schemas = DBSchemas.MES,
            MainTableField = "TaskSelfID")
    public float ActNum = 0.0f;


    /**
     * 作业人ID
     */
    @DBJoin(name = "WorkerID", tableName = "sfc_task_self", tableAsName = "sfc_task_self1", Schemas = DBSchemas.MES,
            MainTableField = "TaskSelfID")
    public int WorkerID = 0;
    /**
     * 作业人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user1", Schemas = DBSchemas.Basic, JoinIndex = 3,
            ConditionalJoin = "sfc_task_self1.WorkerID=mbs_user1.ID")
    public String WorkerName = "";

    /**
     * 打卡记录类型
     */
    @DBCondition
    @DBField
    public int LoginType = 0;
    /**
     * 打卡记录类型
     */
    public String LoginTypeText = "";

    @JsonProperty("OrderID")
    public int getOrderID() {
        return OrderID;
    }

    public void setOrderID(int orderID) {
        OrderID = orderID;
    }

    @JsonProperty("OrderNo")
    public String getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(String orderNo) {
        OrderNo = orderNo;
    }

    @JsonProperty("RoutePartID")
    public int getRoutePartID() {
        return RoutePartID;
    }

    public void setRoutePartID(int routePartID) {
        RoutePartID = routePartID;
    }

    @JsonProperty("RoutePartName")
    public String getRoutePartName() {
        return RoutePartName;
    }

    public void setRoutePartName(String routePartName) {
        RoutePartName = routePartName;
    }

    @JsonProperty("RoutePartPointID")
    public int getRoutePartPointID() {
        return RoutePartPointID;
    }

    public void setRoutePartPointID(int routePartPointID) {
        RoutePartPointID = routePartPointID;
    }

    @JsonProperty("RoutePartPointName")
    public String getRoutePartPointName() {
        return RoutePartPointName;
    }

    public void setRoutePartPointName(String routePartPointName) {
        RoutePartPointName = routePartPointName;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductCode")
    public String getProductCode() {
        return ProductCode;
    }

    public void setProductCode(String productCode) {
        ProductCode = productCode;
    }

    @JsonProperty("ComponentNumber")
    public int getComponentNumber() {
        return ComponentNumber;
    }

    public void setComponentNumber(int componentNumber) {
        ComponentNumber = componentNumber;
    }

    @JsonProperty("TaskPartID")
    public int getTaskPartID() {
        return TaskPartID;
    }

    public void setTaskPartID(int taskPartID) {
        TaskPartID = taskPartID;
    }

    @JsonProperty("TaskPartPointID")
    public int getTaskPartPointID() {
        return TaskPartPointID;
    }

    public void setTaskPartPointID(int taskPartPointID) {
        TaskPartPointID = taskPartPointID;
    }

    @JsonProperty("TaskPartPointDayID")
    public int getTaskPartPointDayID() {
        return TaskPartPointDayID;
    }

    public void setTaskPartPointDayID(int taskPartPointDayID) {
        TaskPartPointDayID = taskPartPointDayID;
    }

    @JsonProperty("WorkShopID")
    public int getWorkShopID() {
        return WorkShopID;
    }

    public void setWorkShopID(int workShopID) {
        WorkShopID = workShopID;
    }

    @JsonProperty("WorkShopName")
    public String getWorkShopName() {
        return WorkShopName;
    }

    public void setWorkShopName(String workShopName) {
        WorkShopName = workShopName;
    }

    @JsonProperty("WorkShopCode")
    public String getWorkShopCode() {
        return WorkShopCode;
    }

    public void setWorkShopCode(String workShopCode) {
        WorkShopCode = workShopCode;
    }

    @JsonProperty("WorkAreaID")
    public int getWorkAreaID() {
        return WorkAreaID;
    }

    public void setWorkAreaID(int workAreaID) {
        WorkAreaID = workAreaID;
    }

    @JsonProperty("WorkAreaName")
    public String getWorkAreaName() {
        return WorkAreaName;
    }

    public void setWorkAreaName(String workAreaName) {
        WorkAreaName = workAreaName;
    }

    @JsonProperty("WorkAreaCode")
    public String getWorkAreaCode() {
        return WorkAreaCode;
    }

    public void setWorkAreaCode(String workAreaCode) {
        WorkAreaCode = workAreaCode;
    }

    @JsonProperty("StationID")
    public int getStationID() {
        return StationID;
    }

    public void setStationID(int stationID) {
        StationID = stationID;
    }

    @JsonProperty("StationName")
    public String getStationName() {
        return StationName;
    }

    public void setStationName(String stationName) {
        StationName = stationName;
    }

    @JsonProperty("StationCode")
    public String getStationCode() {
        return StationCode;
    }

    public void setStationCode(String stationCode) {
        StationCode = stationCode;
    }

    @JsonProperty("StationDate")
    public Calendar getStationDate() {
        return StationDate;
    }

    public void setStationDate(Calendar stationDate) {
        StationDate = stationDate;
    }

    @JsonProperty("ShiftType")
    public int getShiftType() {
        return ShiftType;
    }

    public void setShiftType(int shiftType) {
        ShiftType = shiftType;
    }

    @JsonProperty("SPlantNum")
    public float getSPlantNum() {
        return SPlantNum;
    }

    public void setSPlantNum(float SPlantNum) {
        this.SPlantNum = SPlantNum;
    }

    @JsonProperty("DPlantNum")
    public float getDPlantNum() {
        return DPlantNum;
    }

    public void setDPlantNum(float DPlantNum) {
        this.DPlantNum = DPlantNum;
    }

    @JsonProperty("TaskSelfID")
    public int getTaskSelfID() {
        return TaskSelfID;
    }

    public void setTaskSelfID(int taskSelfID) {
        TaskSelfID = taskSelfID;
    }

    @JsonProperty("PlantNum")
    public float getPlantNum() {
        return PlantNum;
    }

    public void setPlantNum(float plantNum) {
        PlantNum = plantNum;
    }

    @JsonProperty("ActNum")
    public float getActNum() {
        return ActNum;
    }

    public void setActNum(float actNum) {
        ActNum = actNum;
    }

    @JsonProperty("WorkerID")
    public int getWorkerID() {
        return WorkerID;
    }

    public void setWorkerID(int workerID) {
        WorkerID = workerID;
    }

    @JsonProperty("WorkerName")
    public String getWorkerName() {
        return WorkerName;
    }

    public void setWorkerName(String workerName) {
        WorkerName = workerName;
    }

    @JsonProperty("RecordType")
    public int getLoginType() {
        return LoginType;
    }

    public void setLoginType(int loginType) {
        LoginType = loginType;
    }

    @JsonProperty("RecordTypeText")
    public String getLoginTypeText() {
        LoginTypeText = SFCLoginType.getEnumType(LoginType).getLabel();
        return LoginTypeText;
    }

    public void setLoginTypeText(String loginTypeText) {
        LoginTypeText = loginTypeText;
    }
}
